# PowerShell script to test icon in executable
param(
    [string]$ExePath = "dist\filehive-embedded-windows-amd64.exe"
)

Write-Host "Testing icon in: $ExePath" -ForegroundColor Yellow

try {
    # Load System.Drawing assembly
    Add-Type -AssemblyName System.Drawing
    
    # Extract icon from executable
    $icon = [System.Drawing.Icon]::ExtractAssociatedIcon($ExePath)
    
    if ($icon -ne $null) {
        Write-Host "✓ Icon found in executable!" -ForegroundColor Green
        Write-Host "  Icon size: $($icon.Width)x$($icon.Height)" -ForegroundColor Cyan
        Write-Host "  Icon handle: $($icon.Handle)" -ForegroundColor Cyan
        
        # Test if it's a custom icon (not default)
        $defaultIcon = [System.Drawing.SystemIcons]::Application
        if ($icon.Handle -ne $defaultIcon.Handle) {
            Write-Host "✓ Custom icon detected (not default application icon)" -ForegroundColor Green
        } else {
            Write-Host "⚠ Using default application icon" -ForegroundColor Yellow
        }
        
        return $true
    } else {
        Write-Host "✗ No icon found" -ForegroundColor Red
        return $false
    }
}
catch {
    Write-Host "✗ Error extracting icon: $($_.Exception.Message)" -ForegroundColor Red
    return $false
}
finally {
    if ($icon) {
        $icon.Dispose()
    }
} 